package htpp;

import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest;

import util.Utils;

/**
 * Created by Administrator on 2017/5/29 0029.
 */

public class Httpconnection {
    String json;
    String type;
  public   String getJsonData(String type) {


        new HttpUtils().send(HttpRequest.HttpMethod.GET,
                "http://wangyi.butterfly.mopaasapp.com/news/api?type="+type+"&page=1&limit=12",
                new RequestCallBack<String>() {
                    @Override
                    public void onSuccess(ResponseInfo<String> responseInfo) {
                      json = responseInfo.result;
                      System.out.println("}}}}}"+json);
                        //保存json文件


                        //   timer.schedule(timetask, 2000); //定时器

                    }

                    @Override
                    public void onFailure(HttpException e, String s) {

                        Utils.show("当前网络不可访问");

                    }
                });
  System.out.println("+++++++++"+json);
        return json;
    }


}
